15 / 16

When would you choose a Linked List over an Array?

Choosing a Linked List

  1. 1

    Frequent insertion and deletion where node references are already available.

  2. 2

    Workloads where contiguous memory allocation is undesirable or difficult.

  3. 3

    Structures naturally represented through links between nodes.

  4. 4

    Cases requiring stable node references under insertion or deletion, depending on the language and collection semantics.

  5. 5

    Avoid linked lists when frequent random access is required.

  6. 6

    Avoid them when memory locality and iteration performance are more important than cheap structural modification.

Difficulty: 2/10

Follow-up Questions

  • Why are arrays often faster despite O(n) insertion?
  • What workloads favor a deque?